<?php
namespace App\Core\Response;

use App\Core\Entity\Message\ResponseError as MessageResponseError;
use App\Core\Entity\Message\MessageError;

/**
 * 定义异常 Response 结构的唯一入口
 */
class ResponseError implements ResponseInterface
{

    private $response;

    public function __construct($code = 40000, $message = '', array $errors = [])
    {
        $this->response = new MessageResponseError();
        $this->response->setMessageError(new MessageError($code, $message, $errors));
    }

    public function getResponse()
    {
        return $this->response->getResponse();
    }
}